#时间包用来做等待
from time import sleep
#网站驱动
from selenium import webdriver
#导入服务
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

#实例化服务
service = Service(executable_path='./chromedriver.exe')
#实例化驱动 前面sercive是参数，后面是变量名
driver = webdriver.Chrome(service=service)

driver.get("file://D:\素材.html")

#自动化

#自动全屏显示 最大化
driver.maximize_window()
#时间间隔长一些
sleep(3)

driver.find_element(By.XPATH,'//input[@value="输入框弹窗按钮"]').click()
sleep(3)
driver.switch_to.alert.send_keys("2")
sleep(2)
#弹窗点击确认
# driver.switch_to.alert.accept()
driver.switch_to.alert.dismiss()
result = driver.find_element(By.TAG_NAME,"font").text
print(result)

sleep(3)
#可以不写 quit
driver.quit()
